<?php
/* $Id: menus.php,v 1.2 2003/10/08 07:11:12 tuxmonkey Exp $ */
/** 
 * @package Issue-Tracker
 * @subpackage Administration
 */

if (strpos($_SERVER['PHP_SELF'],basename(__FILE__)) !== false) {
  print "Direct module access forbidden.".basename(__FILE__);exit;}
  

if (is_employee()) {
 $leftnav_menu[$lg->menu_admin] = "?module=admin";
}


// Menu 1 - Tickets
if ($_SESSION['group_count'] > 0) 
{
  $leftnav_menu[$lg->issues] = array(
    "url"       => "?module=issues",
    "sub"       => array(
      $lg->new_issue       => "?module=issues&action=new",
      $lg->my_opened       => "?module=issues&action=mopen",
      $lg->my_assigned     => "?module=issues&action=my_assigned",
      $lg->by_status       => "?module=issues&action=status&sid="._DEFAULTMENUSTATUS_,
      $lg->search          => "?module=issues&action=search",
      $lg->issue_sets      => "?module=isets"
    )
  );

  $leftnav_menu[$lg->announces] = array(
      "url"     => "?module=announce",
      "sub"   => array(
      $lg->new_announce => "?module=announce&action=new"
    )
  );

}
if (is_employee())
{
	$leftnav_menu[$lg->hotline] = array(
      "url"     => "?module=hotline",
      "sub"   => array($lg->groups => "?module=hotline&action=show" ));

	  if (is_manager() || permission_check("Hotline-Oplog") ) 	  
	   $leftnav_menu[$lg->hotline]["sub"][$lg->oplog] = "?module=hotline&action=oplog";
	  
	$leftnav_menu[$lg->time_sheet] = array(
      "url"     => "?module=time_sheet&action=show",
      "sub"   => array(
      $lg->my_time_sheet => "?module=time_sheet&action=show"
    )
  );
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_staff]    = "?module=users&action=gantt";
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_bonus]    = "?module=hrmd&action=primes";
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_hrev]     = "?module=hrmd&action=event";
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_holidays] = "?module=holidays&action=show";
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_groups] = "?module=issues&action=mygroups";	
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->my_stats]    = "?module=stats&action=users";
    $leftnav_menu[$lg->time_sheet]["sub"][$lg->qual_user]   = "?module=hrmd&action=qual_user";
	

  if (is_manager() || permission_check("Team-Stats") ) 
  {
    $leftnav_menu[$lg->time_sheet]["sub"]["Team Stats"]           = "?module=stats&action=team";
    $leftnav_menu[$lg->time_sheet]["sub"]["Team Global Stats"]    = "?module=stats&action=team_global";
  }	
  if (is_manager() || permission_check("TeamTs-see") ) 
    $leftnav_menu[$lg->time_sheet]["sub"]["Team TS"]    = "?module=time_sheet&action=team";


}

// Menu de suivi 
if ( permission_check("Suivi") || is_manager() ) 
{
  $leftnav_menu[$lg->suivi] = array("url" => "?module=suivi" );
  if (is_manager() || permission_check("Msgrp-View") )
  	$leftnav_menu[$lg->suivi]["sub"][$lg->msgrp]    = "?module=issues&action=msgrp";
  if (is_manager() || permission_check("Suivi-Group-View") )
  	$leftnav_menu[$lg->suivi]["sub"][$lg->group]    = "?module=suivi&action=group";	  
  if (is_manager() || permission_check("Suivi-team") )
  	$leftnav_menu[$lg->suivi]["sub"][$lg->by_team]  = "?module=suivi&action=team";
  if (is_manager() || permission_check("Suivi-gantt") )
  	$leftnav_menu[$lg->suivi]["sub"][$lg->staffing] = "?module=suivi&action=gantt";
  if (is_manager() || permission_check("Suivi-invoice") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->stafex]  = "?module=suivi&action=stafex";	
  if (is_manager() || permission_check("Suivi-cost") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->cost]     = "?module=suivi&action=cost";
  if (is_manager() || permission_check("Suivi-invoice") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->invoice]  = "?module=suivi&action=invoice";

  if (is_manager() || permission_check("Suivi-quality") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->quality]  = "?module=suivi&action=times";
  if (is_manager() || permission_check("Suivi-indic") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->indic]    = "?module=suivi&action=indic";
  if (is_manager() || permission_check("Suivi-stats") )	
  	$leftnav_menu[$lg->suivi]["sub"][$lg->stats]    = "?module=suivi&action=stats";	
}
if ( permission_check("Hrmd") || is_manager() ) 
{
// Menu de HR
  $leftnav_menu[$lg->hrmd] = array("url" => "?module=hrmd" );
  $leftnav_menu[$lg->hrmd]["sub"][$lg->holidays]     = "?module=holidays&action=team";
  if(permission_check("Hrmd-Team-Bonus"))	
  	$leftnav_menu[$lg->hrmd]["sub"][$lg->bonus_team]   = "?module=hrmd&action=bonus_team";
  if(permission_check("Hrmd-Team-Score"))	
	$leftnav_menu[$lg->hrmd]["sub"][$lg->score_team]   = "?module=hrmd&action=score_team";
  if(permission_check("Hrmd-Team-Staff"))	
  	$leftnav_menu[$lg->hrmd]["sub"][$lg->team_staff]   = "?module=hrmd&action=staff_team"; 
  if(permission_check("Hrmd-Team-Qual"))	  
  	$leftnav_menu[$lg->hrmd]["sub"][$lg->qual_team]    = "?module=hrmd&action=qual_team";
  if(permission_check("Hrmd-Team-QRank"))		
	$leftnav_menu[$lg->hrmd]["sub"][$lg->qual_rk_team] = "?module=hrmd&action=qual_rank";
  if(permission_check("Hrmd-Team-Evnt"))		
  $leftnav_menu[$lg->hrmd]["sub"][$lg->hre_list]     = "?module=hrmd&action=event_list";  
  if(permission_check("Hrmd-Team-Hotl"))	 
	$leftnav_menu[$lg->hrmd]["sub"][$lg->hotl_primes]  = "?module=hrmd&action=hotl_primes";	
}
if ( permission_check("plan-view") || is_manager() ) 
{
// Menu de Planification
  $leftnav_menu[$lg->plan] = array("url" => "?module=plan" );
  $leftnav_menu[$lg->plan]["sub"][$lg->edit]   = "?module=plan&action=edit";	
  $leftnav_menu[$lg->plan]["sub"][$lg->export] = "?module=plan&action=export";	
}
/*
if (is_manager($_SESSION['userid']))
{					
  $leftnav_menu[$lg->assets] = array(
    "url"       => "?module=assets",
    "sub"       => array(
      $lg->edit   => "?module=assets",
      $lg->new  => "?module=assets&action=new",
      $lg->managers   => "?module=assets&action=choose_resp"
    )
  );
}
*/
if (is_employee()) {
  $leftnav_menu["Reports"] = array(
    "url"   => "?module=reports",
    "sub"   => array(
      "Stored Reports" => "?module=reports&action=manage"
    )
  );
  
  if (is_manager()) {
    $leftnav_menu["Reports"]["sub"]["Technician Reports"] = "?module=reports&action=tech";
	$leftnav_menu["Reports"]["sub"]["Report mensuel"] = "?module=reports&action=flex";
  }
}
/*
$leftnav_menu[$lg->preferences] = array(
    "url"       => "?module=prefs",
    "sub"   => array()
);
*/
if (is_admin()) {           // MOD JOP turn-off this option for the moment ...
/*
if ($_SESSION['group_count'] > 0) 
{
  $leftnav_menu[$lg->preferences]['sub'][$lg->group_pref] = "?module=prefs&action=group";
}
*/
/*
if (is_writable(_THEMES_)
and !ereg("(4.7)|(4.8)",$_SERVER['HTTP_USER_AGENT'])) {
  $leftnav_menu[$lg->preferences]['sub'][$lg->style] = "?module=prefs&action=style";
}
*/
}

if (permission_check("read_doc")) {
  $leftnav_menu[$lg->doc_cats] = array( "url" => "?module=docs", );
}

if (is_manager($_SESSION['userid'])) {
  $leftnav_menu[$lg->files] = array(
    "url"       => "?module=files&sort_by=uploaded_on",
    "sub"       => array(
      $lg->parameters            => "?module=admin&action=genconfig&cid=2",
      $lg->by." ".$lg->date      => "?module=files&sort_by=uploaded_on",
      $lg->by." ".$lg->user      => "?module=files&sort_by=userid",
    )
  );
}

if (!empty($_SESSION['ADMIN_UID']) and is_admin($_SESSION['ADMIN_UID'])) {
  $leftnav_menu[$lg->switch_back] = "?module=admin&action=switch_users&return=true";
}

?>